package com.xca.znb.database;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import androidx.annotation.Nullable;

public class CollectDBHelper extends SQLiteOpenHelper {

    private static final String DATABASE_NAME = "collect.db" ;
    private static final int DATABASE_VERSION = 1 ;

    public static final String TABLE_COLLECT = "collect" ;
    public static final String COLLECT_ID = "id" ;
    public static final String COLLECT_GID = "gId" ;
    public static final String COLLECT_TYPE = "type" ;
    public static final String COLLECT_USER = "user" ;

    private static final String CREATE_TABLE_COLLECT = "CREATE TABLE " +
            TABLE_COLLECT + "( " +
            COLLECT_ID + " INTEGER PRIMARY KEY AUTOINCREMENT ," +
            COLLECT_GID + " TEXT ," +
            COLLECT_TYPE + " TEXT ," +
            COLLECT_USER + " TEXT )" ;
    public CollectDBHelper(@Nullable Context context) {
        super(context, DATABASE_NAME, null, DATABASE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_TABLE_COLLECT);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("DROP TABLE IF EXISTS " + TABLE_COLLECT);
        onCreate(db);
    }
}
